-- 有节必诛
local youjiebizhu = fk.CreateSkill {
    name = "mcdh_youjiebizhu",
}

youjiebizhu:addEffect('viewas',{
    card_filter = Util.FalseFunc,
    view_as = function (self, cards)
        local card = Fk:cloneCard("slash")
        card.skillName = self.name
        return card
    end,
    before_use = function (self, player, use)
        player:showCards(player.player_cards[Player.Hand])
        player.room:delay(300)
    end,
    enabled_at_play = function(self, player)
        return player:usedSkillTimes(self.name, Player.HistoryPhase) == 0 and not player:isKongcheng()
    end,
    enabled_at_response = Util.FalseFunc,
})

youjiebizhu:addEffect(fk.TargetSpecified,{
    can_refresh = function(self, event, target, player, data)
        return target == player and player:hasSkill("mcdh_youjiebizhu") and data.card.trueName == "slash" and table.contains(data.card.skillNames,"mcdh_youjiebizhu")
    end,
    on_refresh = function(self, event, target, player, data)
        local room = player.room
        local to = room:getPlayerById(data.to)
        local use_event = room.logic:getCurrentEvent():findParent(GameEvent.UseCard, true)
        if use_event == nil then return end
        room:addPlayerMark(to, fk.MarkArmorNullified)
        use_event:addCleaner(function()
            room:removePlayerMark(to, fk.MarkArmorNullified)
        end)
    end,
})

return youjiebizhu